/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package hu.arguscab.graphic;

import hu.arguscab.physic.Vector;
import static org.lwjgl.opengl.GL11.*;


/**
 *
 * @author sharp
 */
public class Line extends DrawablePrimitive{

	private int x1, y1;

	public Line() {
		
	}
	
	public Line(int x1, int y1, int x2, int y2) {
		setX(x1);
		setY(y1);
		this.x1 = x2 - x1;
		this.y1 = y2 - y1;
	}

	@Override
	public int getGLType() {
		return GL_LINES;
	}

	@Override
	public void drawImpl() {
		glVertex3i(0, 0, 0);
		glVertex3i(x1, y1, 0);
	}

	public void setEndPoint(float x1, float y1) {
		this.x1 = (int) x1;
		this.y1 = (int) y1;
	}

	public void setEndPoint(Vector pos) {
		this.x1 = (int) pos.getX() - getX();
		this.y1 = (int) pos.getY() - getY();
	}
}
